package cm.dayo3.Test2;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {

        Student stu1=new Student("小明",18);
        Student stu2=new Student("小红",19);
        ArrayList<Student>list=new ArrayList<>();
        list.add(stu1);
        for (int i = 0; i < list.size(); i++) {
            System.out.print("姓名"+list.get(i).getName()+",年龄"+list.get(i).getAge());
            provideInfo(Constant.BOY);
        }
        ArrayList<Student>list1=new ArrayList<>();
        list1.add(stu2);
        for (int i = 0; i < list.size(); i++) {
            System.out.print("姓名"+list1.get(i).getName()+",年龄"+list1.get(i).getAge());
            provideInfo(Constant.GRIL);
        }
    }
    public static void provideInfo(Constant sex){
        switch (sex){
            case BOY:
                System.out.println(",性别:"+sex);
                break;
            case GRIL:
                System.out.println(",性别:"+sex);
                break;
        }
    }


}
